package com.offcn.controller;


import com.alibaba.dubbo.config.annotation.Reference;
import com.offcn.service.TSetmealService;
import com.offcn.util.MessageConstant;
import com.offcn.util.PageResult;
import com.offcn.util.QueryPageBean;
import com.offcn.util.Result;
//import jdk.nashorn.internal.ir.annotations.Reference;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yjq
 * @since 2021-08-09
 */
@RestController
@RequestMapping("setmeal")
public class TSetmealController {
    @Reference
    private TSetmealService tsetmealService;
  /*  @PostMapping("findPage")
    public Result findPage(@RequestBody QueryPageBean PageBean){
        try {
            PageResult pageResult =  tSetmealService.findPage(PageBean);
            return new Result(true, MessageConstant.QUERY_SETMEAL_SUCCESS,pageResult);
        }catch (Exception e){
            e.printStackTrace();
            return new Result(false, MessageConstant.QUERY_SETMEAL_FAIL,null);
        }
    }*/

    //分页列表查询
    @PostMapping("findPage")
    public Result findPage(@RequestBody QueryPageBean pageBean){
        try{
            System.out.println(pageBean);
            PageResult pageResult = tsetmealService.findPage(pageBean);
            return new Result(true, MessageConstant.QUERY_SETMEAL_SUCCESS,pageResult);
        }catch (Exception e){
            e.printStackTrace();
            return new Result(false, MessageConstant.QUERY_SETMEAL_FAIL,null);
        }
    }
}

